package alchemist.model;

public class Element implements Comparable< Element >
{
    private String  id;
    private String  name;
    private Boolean finalElement;

    public Element()
    {
    }

    public Element( String id, String name, Boolean finalElement )
    {
        super();
        this.id = id;
        this.name = name;
        this.finalElement = finalElement;
    }

    public Element( String name, Boolean finalElement )
    {
        super();
        this.name = name;
        this.finalElement = finalElement;
    }

    @Override
    public int hashCode()
    {
        final int prime = 31;
        int result = 1;
        result = prime * result + ( ( id == null ) ? 0 : id.hashCode() );
        return result;
    }

    @Override
    public boolean equals( Object obj )
    {
        if ( this == obj )
            return true;
        if ( obj == null )
            return false;
        if ( getClass() != obj.getClass() )
            return false;
        Element other = ( Element ) obj;
        if ( id == null )
        {
            if ( other.id != null )
                return false;
        }
        else if ( !id.equals( other.id ) )
            return false;
        return true;
    }

    public String getId()
    {
        return id;
    }

    public void setId( String id )
    {
        this.id = id;
    }

    public String getName()
    {
        return name;
    }

    public void setName( String name )
    {
        this.name = name;
    }

    public Boolean getFinalElement()
    {
        return finalElement;
    }

    public void setFinalElement( Boolean finalElement )
    {
        this.finalElement = finalElement;
    }
    
    public String getImagePath()
    {
        return "/imgelem/" + this.id + ".png";
    }

    @Override
    public String toString()
    {
        return "Element [id=" + id + ", name=" + name + ", finalElement=" + finalElement + "]";
    }

	@Override
	public int compareTo( Element anotherElement ) 
	{
		return this.name.compareTo( anotherElement.name );
	}

}
